--[[ 编码: WMS-82-03 名称: 批量入库测试-删除后 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: AfterDataObjDelete 功能: 删除容器,如果有和货位绑定解绑 变更记录: --]] wms_wh = require( "wms_wh" ) function AfterDataObjDelete ( strLuaDEID ) local nRet, strRetInfo -- step1 获取当前删除的作业编码 local test nRet, test = m3.GetSysCurEditDataObj( strLuaDEID, "TEST_Inbound" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..test ) end if ( test.cntr_code ~= '' and test.cntr_code ~= nil ) then end -- step2 如果没有错误信息,并且S_LOC_CODE有值,需要解绑容器和货位 if ( test.loc_code ~= '' and test.err == '') then local loc bRet, loc = wms_wh.GetLocInfo( test.loc_code) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "WMS_GetLocInfo失败! "..loc ) end nRet, strRetInfo = wms_wh.Loc_Container_Unbinding( strLuaDEID, loc.code, test.cntr_code, "绑定解绑方法-人工", "测试数据用例" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '货位容器绑定失败!'..strRetInfo ) end -- 减库区/仓库量表 (通过CG_Detail) nRet, strRetInfo = wms_base.Reduce_WHAreaQty_ByCGDetail(strLuaDEID, loc.wh_code, loc.area_code, test.cntr_code ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), 'wms_base.Reduce_WHAreaQty_ByCGDetail失败!'..strRetInfo ) end end local strCondition = "S_CODE = '"..test.cntr_code.."'" nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Container", strCondition ) if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Container】失败! "..strRetInfo ) end end